Indirect Inference ================== Besides full-information (maximum-likelihood / Bayesian) estimation, RISE can estimate a model by **limited-information** methods: choose the parameters so that a set of *auxiliary statistics* implied by the model -- moments, impulse responses, regression coefficients, ... -- matches the same statistics computed from the data, in a weighted-distance sense. A good reference in the DSGE literature is :cite:`Ruge-Murcia2012`. The principle of indirect inference ----------------------------------- Let :math:`\widehat{a}` collect the auxiliary statistics computed from the data and :math:`a\left(\theta\right)` the same statistics implied by the model at parameter vector :math:`\theta`. Indirect inference solves .. math:: \widehat{\theta}=\arg\min_{\theta}\;\left[\widehat{a}-a\left(\theta\right)\right]'\, W\;\left[\widehat{a}-a\left(\theta\right)\right], for a positive-definite weighting matrix :math:`W` (often the identity, or the inverse of the sampling covariance of :math:`\widehat{a}` for the efficient choice). Different choices of the auxiliary statistics give the generalized method of moments, the simulated method of moments, impulse-response matching, and so on. Indirect inference in RISE -------------------------- RISE does not prescribe the auxiliary statistics or the distance metric -- you supply them as a MATLAB function, and RISE handles the optimisation over the parameters (with the same optimisers, bounds and priors as full-information estimation; see :doc:`Posterior maximization`):: mest = indirect_inference(m, myobjective, 'priors', priors); Here ``priors`` lists the parameters to estimate and their supports, exactly as for :doc:`Bayesian / ML estimation `, and ``myobjective`` is a function handle with signature:: function [critmin, retcode] = myobjective(m) % m : the model object, already parameterised (and, if needed, solved) % critmin : the criterion to minimise % retcode : 0 if critmin was computed successfully, a nonzero RISE % return code otherwise (decipher(retcode) explains it) When ``indirect_inference`` runs, RISE skips data loading and filtering -- the objective does whatever is needed -- and minimises ``critmin`` over the listed parameters. Any usual model option can be passed through as extra name/value pairs. Generalized method of moments ----------------------------- For (analytical) GMM the auxiliary statistics are population moments. Inside ``myobjective`` you compute the model-implied moments from the solved model -- ``theoretical_moments(m)`` and ``theoretical_autocovariances(m)`` / ``theoretical_autocorrelations(m)`` give the variances, covariances and autocovariances implied by the perturbation solution -- stack them into :math:`a\left(\theta\right)`, and return the weighted distance to the empirical moments :math:`\widehat{a}` (computed once from the data and captured by the function handle, together with the weighting matrix):: g = a_model(m) - a_hat; % a_model: stacks the model moments critmin = g' * W * g; retcode = 0; (``a_hat`` and ``W`` are closed over -- e.g. ``myobjective = @(m) gmm_crit(m, a_hat, W)``.) Simulated method of moments --------------------------- When the moments of interest are not available in closed form (nonlinear models, regime-dependent statistics, ...), simulate the model and use the *sample* moments instead: inside ``myobjective``, call ``simulate(m, ...)`` (a long simulation, or several replications), compute the same statistics on the simulated paths as on the data, and return the weighted distance. Fixing the simulation seed makes the criterion smooth in :math:`\theta`. Impulse-response matching ------------------------- Here the auxiliary statistics are impulse responses -- typically estimated from the data with an (S)VAR (see :doc:`../SVAR_capabilities/Main Structural VAR Modeling`). Inside ``myobjective``, compute the model IRFs with ``irf(m, shock_names, H)`` over the matched horizons, stack the entries you want to match, and return the weighted distance to the empirical IRFs (with :math:`W` typically the inverse of the covariance of the empirical IRFs). Indirect inference composes with the rest of the toolbox -- for instance it can be combined with :doc:`optimal simple rules <../DSGE_capabilities/OSR/OptimizedSimpleRules>` (choosing rule coefficients to match empirical statistics) by supplying the corresponding objective. .. todo:: Add a full worked example: pick a model, choose a small moment set, build the data moments and weighting matrix, write ``myobjective``, run ``indirect_inference``, and compare the estimates with the ML ones.